package com.yikang.real.activity;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.yikang.real.R;
import com.yikang.real.application.BaseActivity;
import com.yikang.real.application.RealApplication;
import com.yikang.real.bean.User;

@EActivity(R.layout.login)
public class LoginActivity extends BaseActivity {

	@ViewById(R.id.login)
	public Button login;

	@ViewById
	public EditText login_username;
	@ViewById
	public EditText login_pwd;

	ActionBar actionbar;

	@Bean(value = User.class)
	User user;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		initActionBar();
		RealApplication.initImageLoader(getApplicationContext());
	}

	@Override
	protected void initData() {
		// TODO Auto-generated method stub
	}

	@Override
	protected void initActionBar() {
		// TODO Auto-generated method stub

		actionbar = getSupportActionBar();
		actionbar.setBackgroundDrawable(getResources().getDrawable(
				R.drawable.actionbar));
	}

	@Override
	protected void initListeners() {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub

		return true;
	}

	@Click(value = { R.id.login, R.id.login_text_regist, R.id.login_text_qa })
	public void onclick(View v) {
		switch (v.getId()) {
		case R.id.login:
			openActivity(CheckedActivity_.class);
			break;

		default:
			background();
			break;
		}
	}

	@Background
	public void background() {
		chance();
	}

	@UiThread
	public void chance() {
		login_username.setText("test");
	}

}
